import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import actions from './actions'
import mutations from './mutations'

Vue.use(Vuex)

const store = new Vuex.Store({
  state,
  actions,
  mutations
  // 下面是未拆分前，下面是拆分后
  /*
   state: {
    city: cityName
  },
  actions: {
    changeCity (tcx, city) {
      tcx.commit('changeCity', city)
    }
  },
  mutations: {
    changeCity (state, city) {
      state.city = city
      localStorage.city = city
    }
  }
  */
})

export default store
